/**
 * @(#)SeachDataController.java 2017年6月2日
 * Copyright(C) 2017年6月2日 ZHEXIN IT CO.,LTD. All rights reserved.
 */
package org.jsbd.boss.action;


import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.domian.ScriptCosttimeRecord;
import org.jsbd.boss.service.IScriptCosttimeRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 脚本耗时
 * @author <a href="mailto:zhouchao@zhexinit.com" >周超</a>
 * @version 1.0.0
 */
@Controller
@RequestMapping("/scriptCosttimeRecord")
public class ScriptCosttimeRecordController {
	public static final Logger LOGGER = LoggerFactory.getLogger(ScriptCosttimeRecordController.class);
	
	@Autowired
	private IScriptCosttimeRecordService scriptCosttimeRecordService;
	
	@RequestMapping(value = "index")
	public String showNewTaskModel(Model model) throws Exception {
		return "/scriptCosttimeRecord/index";
	}
	
	@ResponseBody
	@RequestMapping("/pageList")
	public Map<String,Object> getNewTaskPageList(DataGridModel page, ScriptCosttimeRecord scriptCosttimeRecord) throws Exception {
		if (StringUtils.isNotBlank(scriptCosttimeRecord.getStart())) {
			scriptCosttimeRecord.setStart(scriptCosttimeRecord.getStart().replaceAll("-", ""));	
		} 
			
		if (StringUtils.isNotBlank(scriptCosttimeRecord.getEnd())) {
			scriptCosttimeRecord.setEnd(scriptCosttimeRecord.getEnd().replaceAll("-", ""));		
		}
		scriptCosttimeRecord.setPageInfo(page);
		return scriptCosttimeRecordService.getListPage(scriptCosttimeRecord);
	}
	
}
